package cn.sumpu.app.guoguojie.dao;

import java.util.List;
import java.util.Map;

import cn.sumpu.app.guoguojie.domain.AdminResource;
import cn.sumpu.app.guoguojie.domain.AdminRole;
import cn.sumpu.app.guoguojie.domain.AdminUser;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;

public interface AdminDao {
	// 插入资源
	public void insertResource(AdminResource adminResource)
			throws AppBusinessException;

	// 更新资源
	public void updateResource(AdminResource adminResource)
			throws AppBusinessException;

	// 删除资源
	public void deleteResourceById(String resourceId)
			throws AppBusinessException;

	// 插入角色
	public void insertRole(AdminRole adminRole) throws AppBusinessException;

	// 更新角色
	public void updateRole(AdminRole adminRole) throws AppBusinessException;

	// 删除角色
	public void deleteRoleById(String roleId) throws AppBusinessException;

	// 插入用户
	public void insertUser(AdminUser adminUser) throws AppBusinessException;

	// 更新用户
	public void updateUser(AdminUser adminUser) throws AppBusinessException;

	// 删除用户
	public void deleteUserById(String userId) throws AppBusinessException;

	// 根据用户名获取用户信息
	public AdminUser getUserByUsername(String username)
			throws AppBusinessException;

	// 获取所有角色(权限)列表
	public List<AdminRole> getAuthorityList() throws AppBusinessException;

	//
	public List<AdminUser> getUserList(Map<String, Object> map)
			throws AppBusinessException;

	// 根据用户名获取用户的角色(权限)列表
	public List<AdminRole> getUserAuthorityList(String username)
			throws AppBusinessException;

	// 用户资源
	public List<AdminResource> getResourceListByAuthorityName(
			String authorityName) throws AppBusinessException;

	public int getAdminUserCount(Map<String, Object> map)
			throws AppBusinessException;

	// 通过userId查询user的role
	public List<AdminRole> getAdminUserRole(String id)
			throws AppBusinessException;

	// 根据用户id删除用户和角色的绑定关系
	public void deleteUserRoleByUserId(String userId)
			throws AppBusinessException;

	// 根据角色id删除用户和角色的绑定关系
	public void deleteUserRoleByRoleId(String roleId)
			throws AppBusinessException;

	// 插入更新的role
	public void insertUserRoleId(Map<String, Object> map)
			throws AppBusinessException;

	// 查询所有的role
	public List<AdminRole> getAdminRole() throws AppBusinessException;

	// role总数统计
	public int getAdminRoleCount(Map<String, Object> map)
			throws AppBusinessException;

	public int getAdminResourceCount(Map<String, Object> map)
			throws AppBusinessException;

	public List<AdminResource> getAdminResourceList(Map<String, Object> map)
			throws AppBusinessException;

	// role集合
	public List<AdminRole> getAdminRoleList(Map<String, Object> map)
			throws AppBusinessException;

	// 通过roleId查询资源
	public List<AdminResource> getAdminRoleResource(String id)
			throws AppBusinessException;

	// 查询所有资源
	public List<AdminResource> getAdminResource() throws AppBusinessException;

	// 根据角色id删除角色和资源的绑定关系
	public void deleteRoleResourceByRoleId(String roleId)
			throws AppBusinessException;

	// 根据资源id删除角色和资源的绑定关系
	public void deleteRoleResourceByResourceId(String resourceId)
			throws AppBusinessException;

	public void insertUserResourceId(Map<String, Object> map)
			throws AppBusinessException;

	public AdminUser getUserById(String id) throws AppBusinessException;

	public AdminRole getRoleById(String id) throws AppBusinessException;

	public AdminResource getResourceById(String id) throws AppBusinessException;
}
